package zhr;


import java.util.Arrays;

public class ex2_6 {
    public static void main(String[] args) {
        int a[] = {5, 4, 2, 9, 1};
        Arrays.sort(a);
        for (int i : a) {
            System.out.println(i + ",");
        }
        System.out.println();
        int[] b = {5, 4, 2, 4, 9, 1};
        bubbleSort(b);
        for (int i : a) {
            System.out.println(i + ",");
        }
    }

    public static int[] bubbleSort(int[] args) {
        for (int i = 0; i < args.length - 1; i++) {
            for (int j = i + 1; j < args.length; j++) {
                if (args[i] > args[j]) {
                    int temp = args[i];
                    args[i] = args[j];
                    args[j] = temp;
                }
            }
        }
        return args;
    }
}

